package pe.com.trener.layer.model.persistence.daoimpl;

/**
 * @author:   Oscar Erick Candela Carbajal
 * @rol:	  Analista Programador
 * @proyecto: Portal Trener
 *
 */

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import pe.com.trener.layer.model.persistence.dao.PlanillonDetalleDao;
import pe.com.trener.layer.model.pojo.PlanillonDetalle;

public class PlanillonDetalleDaoImpl extends HibernateDaoSupport implements PlanillonDetalleDao {

	@SuppressWarnings("unchecked")
	public List<PlanillonDetalle> buscarPorCriterio(Integer codigoPlanillon) throws Exception {
		try {
	        List<PlanillonDetalle> resultQuery = new ArrayList<PlanillonDetalle>();
		 	HibernateTemplate ht = getHibernateTemplate();
  
		 	Object[] values = new Object[1];
	        values[0] = codigoPlanillon;
	        
	        String queryString = " from " +
								 " PlanillonDetalle o " +
								 " where " +
	        					 "     o.planillon.codigoPlanillon = ? ";	        
	        
	        resultQuery = (List<PlanillonDetalle>)ht.find(queryString, values);
	        
	        return resultQuery;
		} catch(Exception e) {
			e.printStackTrace();
			throw new Exception(e);
		} finally {		
		}           
	}	
	
}